package com.Service;

import java.util.List;

import com.Entity.User;
import com.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Service;

import org.springframework.transaction.annotation.Transactional;





@Service("userService")

public class UserServiceImpl implements UserService {

@Autowired

private UserDao userDao;

@Transactional

    public void addUser(User user) {

            userDao.insertUser(user);

            }

@Transactional(readOnly=true)

@Override

public List<User>  login(User user) {

        return userDao.login(user);

        }

@Transactional

@Override

    public int updateUser(User user) {

            return userDao.updateUser(user);

            }

@Transactional

@Override

    public int deleteUser(User user) {

            return  userDao.deleteUser(user);

            }

@Transactional(readOnly=true)

@Override

public List<User> queryUsers() {

        // TODO Auto-generated method stub

        return userDao.queryUsers();

        }

@Transactional(readOnly=true)

@Override

public User getById(int id) {

        return userDao.getById(id);

        }

        }